//
//  MLZCommentsTableViewCell.m
//  MotherLover
//
//  Created by lanou on 16/1/9.
//  Copyright © 2016年 zj. All rights reserved.
//

#import "MLZCommentsTableViewCell.h"

@implementation MLZCommentsTableViewCell

- (void)awakeFromNib {
    // Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _imageIco = [[UIImageView alloc]initWithFrame:CGRectMake(CLandR, CTandB, (KW-CLandR*2-CM)/5, (KW-CLandR*2-CM)/5)];
        //_imageIco.backgroundColor = [UIColor blackColor];
        [self.contentView addSubview:_imageIco];
        //时间
        _labletime= [[UILabel alloc]initWithFrame:CGRectMake(KW-150-CLandR, _imageIco.bottom+CM, 150, 20)];
        //_labletime.backgroundColor = [UIColor blackColor];
        _labletime.font = [UIFont systemFontOfSize:10];
        _labletime.textColor= [UIColor grayColor];
        [self.contentView addSubview:_labletime];
       //楼主名字
        _lableUserName= [[UILabel alloc]initWithFrame:CGRectMake(KW-200-CM-70-CLandR, _imageIco.bottom+CM, 80, 20)];
        _lableContents.adjustsFontSizeToFitWidth= YES;
        //_lableUserName.backgroundColor = [UIColor blackColor];
        _lableUserName.font = [UIFont systemFontOfSize:10];
        _lableUserName.textColor= [UIColor grayColor];
        [self.contentView addSubview:_lableUserName];
        
        _lableContents = [[UILabel alloc]initWithFrame:CGRectMake(_imageIco.right+CLandR, _imageIco.frame.origin.y, KW-CLandR-_imageIco.right-CLandR, _imageIco.height)];
        //_lableContents.backgroundColor = [UIColor blackColor];
        [self.contentView addSubview:_lableContents];
        
        
    }

    return self;



}
-(void)setModel:(MLZPostsModel *)model{

    _labletime.text = model.updatedAt;
    _lableContents.text = model.title;
    _lableUserName.text = model.userName;
    if(model.picture.length==2){
        _imageIco.image  = [UIImage imageNamed:@"xiaotou"];
    }else{
    [_imageIco sd_setImageWithURL:[NSURL URLWithString:model.picture]];
    }


}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
